package com.xinjie.www.service.ban;

import com.xinjie.www.dao.BaseDao;
import com.xinjie.www.dao.ban.BanDao;
import com.xinjie.www.dao.ban.BanDaoImpl;
import com.xinjie.www.po.Ban;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;

public class BanServiceImpl implements BanService{
    private final BanDao banDao;
    public BanServiceImpl(){
        banDao = new BanDaoImpl();
    }
    @Override
    public List<Ban> getBan() throws SQLException, ClassNotFoundException {
        Connection conn = null;
        conn = BaseDao.getConnection();
        List<Ban> bans = null;
        if (conn != null) {
            bans = banDao.getBan(conn);
            BaseDao.closeResource(conn, null, null);
        }
        return bans;
    }
}
